package com.ydy.shardingjdbc.controller;

import com.ydy.shardingjdbc.dto.ProductInfo;
import com.ydy.shardingjdbc.mapper.ShardingJdbcMapper;
import com.ydy.shardingjdbc.service.ShardingJdbcService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("sharding")
public class ShardingJdbcController {

    @Resource
    private ShardingJdbcService shardingJdbcService;

    @GetMapping("insert")
    public String insertProductIndo(Integer id) {
        shardingJdbcService.insertProductInfo(id);
        return "id :" + id + " 插入成功";
    }
}
